<?php

namespace addons\hlapp\controller;

use addons\hlapp\dto\Result;
use addons\hlapp\model\HlappMember;
use addons\hlapp\model\HlappPart;
use addons\hlapp\model\HlappProject;
use addons\hlapp\model\HlappProjectEvaluate;
use addons\hlapp\model\HlappProjectStatus;
use think\Db;

class Part extends Common
{
    public $adminLogin = true;//注意：因为这是后台业务菜单所以需要管理员登录操作的
    public $pageSize = 10;

//-------------
//---- 页面
//-------------
    /**
     * 分页
     */
    public function PartList()
    {
        $this->paginationPage();
        return $this->fetch();
    }
    /**
     * 添加页面
     */
    public function partAdd()
    {
        return $this->fetch();
    }

    /**
     * 添加
     */
    public function addPart(){
        $m = new HlappMember($_POST);
        $mr = $m->allowField(true)->save();
        $pr = $m->parts()->saveAll($_POST['part']);
        if($mr && !empty($pr)){
            return Result::getOk();
        }else{
            return Result::getError();
        }
    }

    /**
     * 分页
     * @return string
     */
    public function pagination()
    {
        $m = new HlappPart();
        $r = $m->getPage(null,'members');
        return Result::getOk($r);
    }

}